package net.lzzy.practicesapi1.entities;

import lombok.*;
import org.hibernate.annotations.GenericGenerator;

import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;
import java.util.UUID;

/**
 * @author lyz
 */
@Getter
@Setter
@NoArgsConstructor(access = AccessLevel.PROTECTED)//生成无参构造
@MappedSuperclass   //映射的注释，不会生成表
public class BaseEntity {
    /**
     * 使用uuid2类型作为自动主键值的生成器
     */
    @Id//表示下面这个是实体类的主键
    @GeneratedValue(generator = "uuid2")
    @GenericGenerator(name = "uuid2",strategy = "uuid2")
    @Column(columnDefinition = "Binary(16)")
    protected UUID id;
}
